home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / duplock.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  3KB  |  120 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: duplock.c,v 1.5 1996/10/24 15:50:26 aros Exp $
  4.     $Log: duplock.c,v $
  5.     Revision 1.5  1996/10/24 15:50:26  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.4  1996/08/13 13:52:54  digulla
  9.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  10.     Replaced AROS_LA by AROS_LHA
  11.  
  12.     Revision 1.3  1996/08/12 14:20:37  digulla
  13.     Added aliases
  14.  
  15.     Revision 1.2  1996/08/01 17:40:49  digulla
  16.     Added standard header for all files
  17.  
  18.     Desc:
  19.     Lang: english
  20. */
  21. #include <clib/exec_protos.h>
  22. #include "dos_intern.h"
  23.  
  24. /*****************************************************************************
  25.  
  26.     NAME */
  27.     #include <clib/dos_protos.h>
  28.  
  29.     AROS_LH1(BPTR, DupLock,
  30.  
  31. /*  SYNOPSIS */
  32.     AROS_LHA(BPTR, lock, D1),
  33.  
  34. /*  LOCATION */
  35.     struct DosLibrary *, DOSBase, 16, Dos)
  36.  
  37. /*  FUNCTION
  38.     Clone a lock on a file or directory. This will only work on shared
  39.     locks.
  40.  
  41.     INPUTS
  42.     lock - Old lock.
  43.  
  44.     RESULT
  45.     The new lock or 0 in case of an error. IoErr() will give additional
  46.     information in that case.
  47.  
  48.     NOTES
  49.     This function is identical to DupLockFromFH().
  50.  
  51.     EXAMPLE
  52.  
  53.     BUGS
  54.  
  55.     SEE ALSO
  56.  
  57.     INTERNALS
  58.  
  59.     HISTORY
  60.     29-10-95    digulla automatically created from
  61.                 dos_lib.fd and clib/dos_protos.h
  62.  
  63. *****************************************************************************/
  64.  
  65. /*****************************************************************************
  66.  
  67.     NAME
  68.     #include <clib/dos_protos.h>
  69.  
  70.     AROS_LH1(BPTR, DupLockFromFH,
  71.  
  72.     SYNOPSIS
  73.     AROS_LHA(BPTR, fh, D1),
  74.  
  75.     LOCATION
  76.     struct DosLibrary *, DOSBase, 62, Dos)
  77.  
  78.     FUNCTION
  79.     Try to get a lock on the object selected by the filehandle.
  80.  
  81.     INPUTS
  82.     fh - filehandle.
  83.  
  84.     RESULT
  85.     The new lock or 0 in case of an error. IoErr() will give additional
  86.     information in that case.
  87.  
  88.     NOTES
  89.     This function is identical to DupLock().
  90.  
  91.     EXAMPLE
  92.  
  93.     BUGS
  94.  
  95.     SEE ALSO
  96.  
  97.     INTERNALS
  98.  
  99.     HISTORY
  100.     29-10-95    digulla automatically created from
  101.                 dos_lib.fd and clib/dos_protos.h
  102.  
  103. *****************************************************************************/
  104. /*AROS alias DupLockFromFH DupLock */
  105. {
  106.     AROS_LIBFUNC_INIT
  107.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  108.  
  109.     BPTR old, new;
  110.     struct Process *me=(struct Process *)FindTask(NULL);
  111.  
  112.     /* Use Lock() to clone the handle. cd to it first. */
  113.     old=me->pr_CurrentDir;
  114.     me->pr_CurrentDir=lock;
  115.     new=Lock("",SHARED_LOCK);
  116.     me->pr_CurrentDir=old;
  117.     return new;
  118.     AROS_LIBFUNC_EXIT
  119. } /* DupLock */
  120.